/*
 * @Author: 肖芬芳 1911683843@qq.com
 * @Date: 2022-12-08 09:49:26
 * @LastEditors: 肖芬芳 1911683843@qq.com
 * @LastEditTime: 2022-12-13 16:27:23
 * @FilePath: \blog\src\views\admin\goods\classify\api\classifyServiceApi.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { ServerResponse } from '@/util/base/ServerResponse'
import { Request } from '@/util/http/axios'
import {SearchList,AddParams,StatusParams,ModifyParams} from "../params/classifyParams"
import {ClassListVo} from "../Vo/classifyVo"

export default class FirstClassServiceApi {
    async getClassList (searchList: SearchList): Promise<ServerResponse<ClassListVo>> {
      const res = await Request.post<ServerResponse<ClassListVo>, SearchList>(
        '/class/list',
        searchList)
      return res.data
    }
  
    async addFirstClass (addParams:AddParams): Promise<ServerResponse<any>> {
      const res = await Request.post<ServerResponse<any>, AddParams>(
        '/class/addFirstClass',
        addParams)
      return res.data
    }
  
    async changeStatus (statusParams:StatusParams): Promise<ServerResponse<any>> {
      const res = await Request.post<ServerResponse<any>, StatusParams>(
        '/class/changeStatus',
        statusParams)
      return res.data
    }
  
    // 获取详情
    async detail(id:string):Promise<ServerResponse<ClassListVo>>{
      const res = await Request.get<ServerResponse<ClassListVo>, string>(
        '/class/detail/'+id+'')
      return res.data
    }
  
    // 编辑
    async modifyFirstClass (modifyParams:ModifyParams): Promise<ServerResponse<ModifyParams>> {
      const res = await Request.post<ServerResponse<ModifyParams>, ModifyParams>(
        '/class/modifyFirstClass',
        modifyParams)
      return res.data
    }
  }